#![allow(unreachable_patterns)]

use crate::entity::EntityType;

pub fn to_id(entity_type: EntityType) -> i16 {
    match entity_type {
        EntityType::AreaEffectCloud => 0,
        EntityType::ArmorStand => 1,
        EntityType::Arrow => 2,
        EntityType::Bat => 3,
        EntityType::Blaze => 4,
        EntityType::Boat => 5,
        EntityType::CaveSpider => 6,
        EntityType::Chicken => 7,
        EntityType::Cod => 8,
        EntityType::ComplexPart => -1,
        EntityType::Cow => 9,
        EntityType::Creeper => 10,
        EntityType::Dolphin => 12,
        EntityType::Donkey => 11,
        EntityType::DragonFireball => 13,
        EntityType::DroppedItem => 32,
        EntityType::Drowned => 14,
        EntityType::Egg => 74,
        EntityType::ElderGuardian => 15,
        EntityType::Enderman => 18,
        EntityType::Endermite => 19,
        EntityType::EnderCrystal => 16,
        EntityType::EnderDragon => 17,
        EntityType::EnderPearl => 75,
        EntityType::EnderSignal => 23,
        EntityType::Evoker => 21,
        EntityType::EvokerFangs => 20,
        EntityType::ExperienceOrb => 22,
        EntityType::FallingBlock => 24,
        EntityType::Fireball => 34,
        EntityType::Firework => 25,
        EntityType::FishingHook => 93,
        EntityType::Ghast => 26,
        EntityType::Giant => 27,
        EntityType::Guardian => 28,
        EntityType::Horse => 29,
        EntityType::Husk => 30,
        EntityType::Illusioner => 31,
        EntityType::IronGolem => 80,
        EntityType::ItemFrame => 33,
        EntityType::LeashHitch => 35,
        EntityType::Lightning => 91,
        EntityType::LingeringPotion => -1,
        EntityType::Llama => 36,
        EntityType::LlamaSpit => 37,
        EntityType::MagmaCube => 38,
        EntityType::Minecart => 39,
        EntityType::MinecartChest => 40,
        EntityType::MinecartCommand => 41,
        EntityType::MinecartFurnace => 42,
        EntityType::MinecartHopper => 43,
        EntityType::MinecartMobSpawner => 44,
        EntityType::MinecartTnt => 45,
        EntityType::Mule => 46,
        EntityType::MushroomCow => 47,
        EntityType::Ocelot => 48,
        EntityType::Painting => 49,
        EntityType::Parrot => 50,
        EntityType::Phantom => 90,
        EntityType::Pig => 51,
        EntityType::PigZombie => 53,
        EntityType::Player => 92,
        EntityType::PolarBear => 54,
        EntityType::PrimedTnt => 55,
        EntityType::Pufferfish => 52,
        EntityType::Rabbit => 56,
        EntityType::Salmon => 57,
        EntityType::Sheep => 58,
        EntityType::Shulker => 59,
        EntityType::ShulkerBullet => 60,
        EntityType::Silverfish => 61,
        EntityType::Skeleton => 62,
        EntityType::SkeletonHorse => 63,
        EntityType::Slime => 64,
        EntityType::SmallFireball => 65,
        EntityType::Snowball => 67,
        EntityType::Snowman => 66,
        EntityType::SpectralArrow => 68,
        EntityType::Spider => 69,
        EntityType::SplashPotion => 77,
        EntityType::Squid => 70,
        EntityType::Stray => 71,
        EntityType::ThrownExpBottle => 76,
        EntityType::TippedArrow => -1,
        EntityType::Trident => 94,
        EntityType::TropicalFish => 72,
        EntityType::Turtle => 73,
        EntityType::Vex => 78,
        EntityType::Villager => 79,
        EntityType::Vindicator => 81,
        EntityType::Weather => -1,
        EntityType::Witch => 82,
        EntityType::Wither => 83,
        EntityType::WitherSkeleton => 84,
        EntityType::WitherSkull => 85,
        EntityType::Wolf => 86,
        EntityType::Zombie => 87,
        EntityType::ZombieHorse => 88,
        EntityType::ZombieVillager => 89,
        EntityType::Unknown => -1,
        _ => -1,
    }
}

pub fn to_entity_type(type_id: i16) -> EntityType {
    match type_id {
        0 => EntityType::AreaEffectCloud,
        1 => EntityType::ArmorStand,
        2 => EntityType::Arrow,
        3 => EntityType::Bat,
        4 => EntityType::Blaze,
        5 => EntityType::Boat,
        6 => EntityType::CaveSpider,
        7 => EntityType::Chicken,
        8 => EntityType::Cod,
        // -1 => EntityType::ComplexPart,
        9 => EntityType::Cow,
        10 => EntityType::Creeper,
        12 => EntityType::Dolphin,
        11 => EntityType::Donkey,
        13 => EntityType::DragonFireball,
        32 => EntityType::DroppedItem,
        14 => EntityType::Drowned,
        74 => EntityType::Egg,
        15 => EntityType::ElderGuardian,
        18 => EntityType::Enderman,
        19 => EntityType::Endermite,
        16 => EntityType::EnderCrystal,
        17 => EntityType::EnderDragon,
        75 => EntityType::EnderPearl,
        23 => EntityType::EnderSignal,
        21 => EntityType::Evoker,
        20 => EntityType::EvokerFangs,
        22 => EntityType::ExperienceOrb,
        24 => EntityType::FallingBlock,
        34 => EntityType::Fireball,
        25 => EntityType::Firework,
        93 => EntityType::FishingHook,
        26 => EntityType::Ghast,
        27 => EntityType::Giant,
        28 => EntityType::Guardian,
        29 => EntityType::Horse,
        30 => EntityType::Husk,
        31 => EntityType::Illusioner,
        80 => EntityType::IronGolem,
        33 => EntityType::ItemFrame,
        35 => EntityType::LeashHitch,
        91 => EntityType::Lightning,
        // -1 => EntityType::LingeringPotion,
        36 => EntityType::Llama,
        37 => EntityType::LlamaSpit,
        38 => EntityType::MagmaCube,
        39 => EntityType::Minecart,
        40 => EntityType::MinecartChest,
        41 => EntityType::MinecartCommand,
        42 => EntityType::MinecartFurnace,
        43 => EntityType::MinecartHopper,
        44 => EntityType::MinecartMobSpawner,
        45 => EntityType::MinecartTnt,
        46 => EntityType::Mule,
        47 => EntityType::MushroomCow,
        48 => EntityType::Ocelot,
        49 => EntityType::Painting,
        50 => EntityType::Parrot,
        90 => EntityType::Phantom,
        51 => EntityType::Pig,
        53 => EntityType::PigZombie,
        92 => EntityType::Player,
        54 => EntityType::PolarBear,
        55 => EntityType::PrimedTnt,
        52 => EntityType::Pufferfish,
        56 => EntityType::Rabbit,
        57 => EntityType::Salmon,
        58 => EntityType::Sheep,
        59 => EntityType::Shulker,
        60 => EntityType::ShulkerBullet,
        61 => EntityType::Silverfish,
        62 => EntityType::Skeleton,
        63 => EntityType::SkeletonHorse,
        64 => EntityType::Slime,
        65 => EntityType::SmallFireball,
        67 => EntityType::Snowball,
        66 => EntityType::Snowman,
        68 => EntityType::SpectralArrow,
        69 => EntityType::Spider,
        77 => EntityType::SplashPotion,
        70 => EntityType::Squid,
        71 => EntityType::Stray,
        76 => EntityType::ThrownExpBottle,
        // -1 => EntityType::TippedArrow,
        94 => EntityType::Trident,
        72 => EntityType::TropicalFish,
        73 => EntityType::Turtle,
        78 => EntityType::Vex,
        79 => EntityType::Villager,
        81 => EntityType::Vindicator,
        // -1 => EntityType::Weather,
        82 => EntityType::Witch,
        83 => EntityType::Wither,
        84 => EntityType::WitherSkeleton,
        85 => EntityType::WitherSkull,
        86 => EntityType::Wolf,
        87 => EntityType::Zombie,
        88 => EntityType::ZombieHorse,
        89 => EntityType::ZombieVillager,
        -1 => EntityType::Unknown,
        _ => EntityType::Unknown,
    }
}
